package com.fourgirls.xiaoxiang.service.ShoppingCart.Impl;


import com.fourgirls.xiaoxiang.dao.ShoppingCartDao.ShoppingCartMapper;
import com.fourgirls.xiaoxiang.dao.ShoppingCartDao.UserShoppingCartMapper;
import com.fourgirls.xiaoxiang.dao.ShoppingDao.UserShoppingMapper;
import com.fourgirls.xiaoxiang.pojo.Shopping.ShoppingVo;
import com.fourgirls.xiaoxiang.pojo.Shopping.UserNameShoppingVo;
import com.fourgirls.xiaoxiang.pojo.Shopping.UserShoppingVo;
import com.fourgirls.xiaoxiang.pojo.ShoppingCart.ShoppingCartIdVo;
import com.fourgirls.xiaoxiang.pojo.ShoppingCart.ShoppingCartVo;
import com.fourgirls.xiaoxiang.pojo.ShoppingCart.UserNameShoppingCartVo;
import com.fourgirls.xiaoxiang.pojo.ShoppingCart.UserShoppingCartVo;
import com.fourgirls.xiaoxiang.service.Shopping.UserShoppingService;
import com.fourgirls.xiaoxiang.service.ShoppingCart.UserShoppingCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserShoppingCartServiceImpl implements UserShoppingCartService {
    @Autowired
    UserShoppingCartMapper userShoppingCartMapper;

    @Autowired
    ShoppingCartMapper shoppingCartMapper;
//---------------------------------------------------------------查询分割线--------------------------------------------------------

    /**
     * 查询medicine表中的所有数据
     *
     * @return 查询的数据
     */
    @Override
    public List<UserShoppingCartVo> findAllUserShopping(UserNameShoppingCartVo userNameShoppingCartVo) {
        return userShoppingCartMapper.findAllUserShoppingCart(userNameShoppingCartVo);
    }

    /**
     * 根据user表中的id查询shopping表中的数据
     * @param shoppingCartVo
     * @return
     */
    @Override
    public int addShoppingCart(ShoppingCartVo shoppingCartVo) {
        return shoppingCartMapper.addShoppingCart(shoppingCartVo);
    }

    @Override
    public int deleteShoppingCart(ShoppingCartIdVo shoppingCartIdVo) {
        return shoppingCartMapper.deleteShoppingCart(shoppingCartIdVo);
    }
}
